<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use View;

class ComposerServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        // 使用类来指定视图组件
        View::composer('Home.profile', 'App\Http\ViewComposers\ProfileComposer');
        // 使用闭包来指定视图组件
        /* View::composer('profile', function($view){
            $view->with('name', 'laravel');
        }); */
    }
    public function register(){}
}